<template>
    <div class="banner">
        <van-swipe class="my-swipe" :autoplay="2000" :show-indicators="false">
            <van-swipe-item v-for="i in bannerList" :key="i">
                <img :src="i" alt="" style="height: 100%;">
            </van-swipe-item>
        </van-swipe>
    </div>
</template>

<script setup lang="ts">
import ajax from '../../apis/Ajax';
import { onMounted,ref } from 'vue'

const bannerList = ref([])

onMounted(() => {
    // 获取banner列表
    ajax({
        url:'/bannerList'
    }).then(({data})=>{
        // console.log(data.rows)
        bannerList.value = data.rows.map((i:any)=>{
            return i.img
        })
    })
})
</script>

<style lang="less">
@import '../../styles/common.less';
.banner {
    // height: 14.3rem;
    width: 100%;
    overflow: hidden;
    .my-swipe .van-swipe-item {
        img {
            width: 100vw;
        }
  }
}
  
</style>